<template>
<slot :controller="controller" :store="store" :model="model">
    <div :class="classNames">
        <slot name="container_scroll1Container" :controller="controller" :store="store" :model="model" >
        <AppScrollContainer 
            name="container_scroll1"
            :layoutModelDetails="store.layoutModelDetails">
            <template #container_scroll_main1>
                <slot name="container_scroll_main1Container" :controller="controller" :store="store" :model="model" >
                <AppScrollContainer 
                    name="container_scroll_main1"
                    :layoutModelDetails="store.layoutModelDetails">
                    <template #nav_tabs1>
                        <slot name="nav_tabs1" :controller="controller" :store="store" :model="model"  :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                        <AppCtrlPos name="nav_tabs1" :layoutModelDetails="store.layoutModelDetails">
                        </AppCtrlPos>
                        </slot>
                    </template>
                    <template #nav_pos1>
                        <slot name="nav_pos1" :controller="controller" :store="store" :model="model" >
                        <AppNavPos 
                            name="nav_pos1"
                            :layoutModelDetails="store.layoutModelDetails"
                            :navData="store.layoutModelDetails['nav_pos1']?.navData"/>
                        </slot>
                    </template>
                    <template #field_switch>
                        <slot name="field_switch" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppPanelField
                            name="field_switch"
                            :value="store.layoutData.field_switch"
                            :layoutModelDetails="store.layoutModelDetails">
                            <slot name="field_switchEditor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                            <AppSwitch
                                v-bind="{ editorType: 'SWITCH', }"
                                style=""
                                name="field_switch"
                                :disabled="store.layoutModelDetails?.field_switch?.disabled ? true : false"
                                :value="store.layoutData.field_switch"
                                @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                            />
                            </slot>
                        </AppPanelField>
                        </slot>
                    </template>
                </AppScrollContainer>
                </slot>
            </template>
            <template #container_scroll_header1>
                <slot name="container_scroll_header1Container" :controller="controller" :store="store" :model="model" >
                <AppScrollContainer 
                    name="container_scroll_header1"
                    :layoutModelDetails="store.layoutModelDetails">
                    <template #container_grid1>
                        <slot name="container_grid1Container" :controller="controller" :store="store" :model="model" >
                        <AppSimpleFlexContainer 
                            name="container_grid1"
                            :layoutModelDetails="store.layoutModelDetails">
                            <template #container1>
                                <slot name="container1Container" :controller="controller" :store="store" :model="model" >
                                <AppStandardContainer 
                                    name="container1"
                                    v-show="store.layoutModelDetails?.container1?.visible"
                                    :isMultiContainer="false"
                                    :layoutModelDetails="store.layoutModelDetails">
                                    <template #app_apptitle>
                                        <slot name="app_apptitle" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                        <AppPresetTitle
                                            name="app_apptitle"
                                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                            :layoutModelDetails="store.layoutModelDetails"/>
                                        </slot>  
                                    </template>
                                </AppStandardContainer>
                                </slot>
                            </template>
                            <template #container2>
                                <slot name="container2Container" :controller="controller" :store="store" :model="model" >
                                <AppStandardContainer 
                                    name="container2"
                                    v-show="store.layoutModelDetails?.container2?.visible"
                                    :isMultiContainer="false"
                                    :layoutModelDetails="store.layoutModelDetails">
                                    <template #container_grid2>
                                        <slot name="container_grid2Container" :controller="controller" :store="store" :model="model" >
                                        <AppSimpleFlexContainer 
                                            name="container_grid2"
                                            :layoutModelDetails="store.layoutModelDetails">
                                            <template #container4>
                                                <slot name="container4Container" :controller="controller" :store="store" :model="model" >
                                                <AppStandardContainer 
                                                    name="container4"
                                                    v-show="store.layoutModelDetails?.container4?.visible"
                                                    :isMultiContainer="false"
                                                    :layoutModelDetails="store.layoutModelDetails">
                                                    <template #nav_breadcrumb1>
                                                        <slot name="nav_breadcrumb1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                                         <AppIndexNavBreadcrumb
                                                            name="nav_breadcrumb1"
                                                            :layoutModelDetails="store.layoutModelDetails"
                                                            :userParams="[
                                                                {
                                                                    key: `test`,
                                                                },
                                                                {
                                                                    key: `highparams`,
                                                                    value: `test`,
                                                                }
                                                            ]"
                                                            :indexViewTag="model.codeName"/>
                                                        </slot>
                                                    </template>
                                                </AppStandardContainer>
                                                </slot>
                                            </template>
                                            <template #container5>
                                                <slot name="container5Container" :controller="controller" :store="store" :model="model" >
                                                <AppStandardContainer 
                                                    name="container5"
                                                    v-show="store.layoutModelDetails?.container5?.visible"
                                                    :isMultiContainer="false"
                                                    :layoutModelDetails="store.layoutModelDetails">
                                                    <template #auth_orgpick>
                                                        <slot name="auth_orgpick" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                                        <AppLoginOrg 
                                                            name="auth_orgpick"
                                                            :value="store.layoutData.auth_orgpick"
                                                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                                            :layoutModelDetails="store.layoutModelDetails"
                                                            defaultIcon="ios-key"/> 
                                                        </slot>   
                                                    </template>
                                                </AppStandardContainer>
                                                </slot>
                                            </template>
                                        </AppSimpleFlexContainer>
                                        </slot>
                                    </template>
                                </AppStandardContainer>
                                </slot>
                            </template>
                            <template #container3>
                                <slot name="container3Container" :controller="controller" :store="store" :model="model" >
                                <AppStandardContainer 
                                    name="container3"
                                    v-show="store.layoutModelDetails?.container3?.visible"
                                    :isMultiContainer="false"
                                    :layoutModelDetails="store.layoutModelDetails">
                                    <template #container_grid3>
                                        <slot name="container_grid3Container" :controller="controller" :store="store" :model="model" >
                                        <AppSimpleFlexContainer 
                                            name="container_grid3"
                                            :layoutModelDetails="store.layoutModelDetails">
                                            <template #container6>
                                                <slot name="container6Container" :controller="controller" :store="store" :model="model" >
                                                <AppStandardContainer 
                                                    name="container6"
                                                    v-show="store.layoutModelDetails?.container6?.visible"
                                                    :isMultiContainer="false"
                                                    :layoutModelDetails="store.layoutModelDetails">
                                                    <template #auth_logout1>
                                                        <slot name="auth_logout1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                                        <AppPresetButton
                                                            name="auth_logout1"
                                                            :loading="store.loadingHelper.isLoading"
                                                            :layoutModelDetails="store.layoutModelDetails"
                                                            :value="store.layoutData.auth_logout1"
                                                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                                                            />
                                                        </slot>
                                                    </template>
                                                </AppStandardContainer>
                                                </slot>
                                            </template>
                                            <template #container7>
                                                <slot name="container7Container" :controller="controller" :store="store" :model="model" >
                                                <AppStandardContainer 
                                                    name="container7"
                                                    v-show="store.layoutModelDetails?.container7?.visible"
                                                    :isMultiContainer="false"
                                                    :layoutModelDetails="store.layoutModelDetails">
                                                    <template #auth_userinfo1>
                                                        <slot name="auth_userinfo1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                                                        <AppIndexUserInfo 
                                                            name="auth_userinfo1"
                                                            :userParams="[
                                                                {
                                                                    key: `test`,
                                                                    value: `test1`,
                                                                    imgValue: `https://img1.baidu.com/it/u=1350435684,987731884&fm=253&app=138&size=w931&n=0&f=JPEG&fmt=auto?sec=1678208400&t=46493942238a7ac131473a583c719694`,
                                                                    type: 'img',
                                                                },
                                                                {
                                                                    key: `highparams`,
                                                                    value: `test`,
                                                                }
                                                            ]"
                                                            :layoutModelDetails="store.layoutModelDetails" />
                                                        </slot>
                                                    </template>
                                                </AppStandardContainer>
                                                </slot>
                                            </template>
                                        </AppSimpleFlexContainer>
                                        </slot>
                                    </template>
                                </AppStandardContainer>
                                </slot>
                            </template>
                        </AppSimpleFlexContainer>
                        </slot>
                    </template>
                </AppScrollContainer>
                </slot>
            </template>
            <template #container_scroll_left1>
                <slot name="container_scroll_left1Container" :controller="controller" :store="store" :model="model" >
                <AppScrollContainer 
                    name="container_scroll_left1"
                    :layoutModelDetails="store.layoutModelDetails">
                    <template #appmenu1>
                        <slot name="appmenu1" :controller="controller" :store="store" :model="model"  :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                        <AppCtrlPos name="appmenu1" :layoutModelDetails="store.layoutModelDetails">
                        </AppCtrlPos>
                        </slot>
                    </template>
                </AppScrollContainer>
                </slot>
            </template>
        </AppScrollContainer>
        </slot>
    </div>
</slot>
</template>
<script setup lang="ts">
// 基于template/src/views/{{appModules}}/{{pages@APPINDEXVIEW}}/{{spinalCase page.codeName}}-base.vue.hbs生成
import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';

import Usr0303573541MenuMenu from '@widgets/app/usr-0303573541-menu-menu/usr-0303573541-menu-menu.vue';
import { IEvent, IIndexViewAbility, IIndexViewStore, IndexViewActionType, IParam } from "@/core";
import { useController, useProps, useBasic, useAction} from './app-index-view-2-hook';
import { MicroActions } from '@/micro/global-state';

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { 
    model,
    getClassNames, 
    useNavParamsBind,
	useEventBind,
    handleQuickSearch,
  	handleToolbarItemClick,
    handleComponentAction,
	handleCtrlAction,
	handleCtrlInit,
	handleCtrlDestroy 
} = useBasic(props);

const emit = defineEmits<{
    (event: 'view-action', name: string, action: IndexViewActionType, data: IParam[]): void;
    (event: 'view-init', name: string, data: IIndexViewAbility): void;
    (event: 'view-mounted', name: string, data: IParam): void;
    (event: 'view-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
const classNames = computed(() => {
  	return getClassNames(props);
});

// 初始化控制器
const controller = useController(props, evt);

useNavParamsBind(controller, props);

const store: IIndexViewStore = controller.getStore();

onMounted(() => {
    controller.viewMounted();
})

onUnmounted(() => {
    controller.viewDestroy();
})

onMounted(() => {
	setTimeout(() => {
		App.noticeBaseApp(MicroActions.APPINIT,true);
	}, 0);
});
</script>